package cn.dengta.webapp.trade.model;

import lombok.Getter;

@Getter
public enum PaymentMethod {

	BANK_TRANSFER("BANK_TRANSFER", 1, "Bank Transfer"),
	WALLET("WALLET", 2, "Wallet"),
	ALIPAY("ALIPAY", 3, "ALIPAY");

	final String code;
	final Integer label;
	final String info;

	PaymentMethod(String code, Integer label, String info) {
		this.code = code;
		this.label = label;
		this.info = info;
	}

	public static PaymentMethod of(Integer label) {
		if (label != null) {
			for (PaymentMethod method : values()) {
				if (label.equals(method.getLabel())) {
					return method;
				}
			}
		}
		return null;
	}

	public boolean bank() {
		return BANK_TRANSFER == this;
	}
}
